home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Data 2002 May / CD Rom Data Mayıs 2002.iso / Freeware / Blitz Basic / data1.cab / Support / help / samples / wierd.bb < prev   
Encoding:
Text File  |  2002-04-10  |  777 b   |  47 lines

  1. ;Swirl demo (featuring Sin & cos)
  2. ;written by Ed Upton
  3.  
  4. Graphics 640,480
  5. SetBuffer BackBuffer()
  6.  
  7. Dim angle(320)
  8. Dim r(320)
  9. Dim g(320)
  10. Dim b(320)
  11.  
  12. Setup()
  13.  
  14. t=0
  15.  
  16. While Not KeyDown(1)
  17. ; Cls
  18.  update()
  19.  Flip
  20.  t=t+1
  21.  If t>30 
  22.   t=0
  23.   Setup()
  24.  EndIf
  25. Wend
  26. End
  27.  
  28. Function Setup()
  29.  For ca=1 To 319
  30.   angle(ca)=0
  31.   r(ca)=Rnd(255)
  32.   g(ca)=Rnd(255)
  33.   b(ca)=Rnd(255)
  34.  Next
  35. End Function
  36.  
  37. Function update()
  38.  For ca=1 To 319
  39.   For nn=angle(ca) To angle(ca)+360 Step 60
  40.    Color r(ca),g(ca),b(ca)
  41.    xx=320+Cos((2*((angle(ca)+nn)*182))*Pi/360)*(ca+ca) ;add +nn next to the ca in (ca) at the end of
  42.    yy=240+Sin((2*((angle(ca)+nn)*182))*Pi/360)*(ca+ca) ;these lines, for another effect
  43.    Plot xx,yy
  44.   Next
  45.   angle(ca)=angle(ca)+ca
  46.  Next
  47. End Function